package com.opengroupe.dao.impl;

// Generated 31 juil. 2012 15:44:44 by Hibernate Tools 3.4.0.CR1

import javax.ejb.Stateless;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.orm.jpa.support.JpaDaoSupport;

import com.opengroupe.dao.QuestionDao;
import com.opengroupe.entities.Question;

/**
 * Home object for domain model class Question.
 * @see com.opengroupe.entities.Question
 * @author Hibernate Tools
 */
@Stateless
public class QuestionDaoImpl extends JpaDaoSupport implements QuestionDao {

	private static final Log log = LogFactory.getLog(QuestionDaoImpl.class);

	public Question persist(Question transientInstance) {
		log.debug("persisting Question instance");
		try {
			getJpaTemplate().persist(transientInstance);
			log.debug("persist successful");
			return transientInstance;
		} catch (RuntimeException re) {
			log.error("persist failed", re);
			throw re;
		}
	}

	public void remove(Question persistentInstance) {
		log.debug("removing Question instance");
		try {
			getJpaTemplate().remove(persistentInstance);
			log.debug("remove successful");
		} catch (RuntimeException re) {
			log.error("remove failed", re);
			throw re;
		}
	}

	public Question merge(Question detachedInstance) {
		log.debug("merging Question instance");
		try {
			Question result = getJpaTemplate().merge(detachedInstance);
			log.debug("merge successful");
			return result;
		} catch (RuntimeException re) {
			log.error("merge failed", re);
			throw re;
		}
	}

	public Question findById(Integer id) {
		log.debug("getting Question instance with id: " + id);
		try {
			Question instance = getJpaTemplate().find(Question.class, id);
			log.debug("get successful");
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}
}
